using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;
using System.Data.SqlClient;
using System.Data.SqlTypes;

namespace Acms.SqlDal
{
    public class UnusedPostControlDal : Base
    {
        public UnusedPostControlDal() : base() { }

        public enum Fields
        {
            Id,
            PostId,
            Name,
            Value,
            AdminControlType
        }

        protected override void ReadRecord(Hashtable table, SqlDataReader reader)
        {
            GetReaderValue<int>(Fields.Id, reader, table);
            GetReaderValue<int>(Fields.PostId, reader, table);
            GetReaderValue<string>(Fields.Name, reader, table);
            GetReaderValue<System.Xml.XmlDocument>(Fields.Value, reader, table);
            GetReaderValue<string>(Fields.AdminControlType, reader, table);
        }

        public Hashtable[] GetAllByPostId(int postId)
        {
            SqlCommand cmd = CreateCommand("GetAllByPostId");
            AddInputParameter(cmd, "PostId", postId, System.Data.SqlDbType.Int);
            return ExecuteGetCollection(cmd);
        }
    }
}
